package com.moonlight.demo.custom;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class CustomEncodingFactory implements ProtocolCodecFactory {
	private CustomEncoder customEncoder;
	
	private CustomDecoder customDecoder;
	
	public CustomEncodingFactory(Charset charset) {
		this.customDecoder = new CustomDecoder(charset);
		this.customEncoder = new CustomEncoder(charset);
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		// TODO Auto-generated method stub
		return this.customEncoder;
	}

	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		// TODO Auto-generated method stub
		return this.customDecoder;
	}

}
